initAuthView();

function initAuthView() {
    show_notif();
    setInterval(show_notif, 5000);
}

function follow() {
    
}

function show_notif() {
    var notif = document.getElementById("profile-notif");

    if(!notif) {
        return;
    }

    var ajax = new AjaxWrap();
    ajax.onLoadSuccess = function(ajax) {
        var unread = Number(ajax.xhr.responseText);
        if (unread > 0) {
            notif.innerHTML = "Notification [" + unread + "]";
        } else {
            notif.innerHTML = "Notification";
        }
    }

    ajax.openAndSend("POST", URL_BASE + "newsfeed/unread", true);
}